package com.gao.calender;

import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.Date;
import java.util.Scanner;

/**
 * @Author: ShanYuqing
 * @Version: v1.0
 */
public class test {
    /*
        需求：键盘录入一个日期字符串，程序输出这个日期是一年中的多少天
     */
    public static void main(String[] args) throws ParseException {
        Scanner sc = new Scanner(System.in);
        System.out.println("请输入xxxx年xx月xx日：");
        String s = sc.nextLine();
        SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy年MM月dd日");
        Date parse = dateFormat.parse(s);
        Calendar c = Calendar.getInstance();
        c.setTime(parse);
        c.get(Calendar.DAY_OF_YEAR);
        System.out.println(c.get(Calendar.DAY_OF_YEAR));

    }
}
